<!-- <!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <link href="/meetTWO/public/static/bootstrap/css/bootstrap.min.css" type="text/css" rel="Stylesheet" />
    <script src="/meetTWO/public/static/jquery/jquery-3.3.1.js" type="text/javascript"></script> -->
{include file="common/head_exit"}
<style>
    /*html {
            height: 100%;
        }

        body {
            height: 100%;
            display: flex;
            justify-content: center;
            align-items: center;

        }*/
    
    #updata-all {
        width: 100%;
        text-align: center;
        margin-top: 20%;
    }
    
    .img-circle {
        height: 150px;
        width: 150px;
        border: 1px solid black;
        text-align: center;
        border-radius: 50%
    }
    
    #updata-text {
        border: 1px solid transparent;
        height: 75px;
        margin-left: 3%;
        margin-right: 3%;
        margin: 0;
        background-color: #39aee8;
        text-align: center;
        position: relative;
        border-radius: 10px;
    }
    
    #updata-text span {
        display: block;
        color: white;
        font-family: inherit;
        height: 100%;
        line-height: 249%;
        font-size: 25px;
        margin: auto 3%;
    }
    
    #updata-head {
        position: absolute;
        top: 0;
        padding: auto 3%;
        width: 100%;
        height: 100%;
        opacity: 0;
    }
</style>
</head>


<body>
    <div id="updata-all">
        <div>
            <img src="/meetTWO/public/static/picture/userHeadImg/{$number}/img.png?rand={$rand}" class="img-circle center-block" alt="照片暂时无法查看" onerror="javascript:this.src='/meetTWO/public/static/picture/defaultHead.jpg';">
        </div>

        <br />
        <br />
        <br />
        <div id="updata-text" style="margin-left: 3%;margin-right: 3%;">
            <span>上传图片</span>
            <input type="file" id="updata-head" accept="image/png,image/gif,image/jpg" name="head-image">
        </div>
        <br />
        <br />
        <br />
    </div>

</body>
<script type="text/javascript">
    $('#updata-head').change(function() {
        var input = $('#updata-head')[0].files[0];
        if (input == undefined || input.size <= 0) {
            alert('请选择word文档')
            return;
        }
        var fromfile = new FormData();
        fromfile.append('file', input, input.value)
        data = fromfile
        $.ajax({
            url: '/meetTWO/public/index/Sign/updataImg',
            data: data,
            type: 'post',
            cache: false,
            processData: false,
            contents: false,
            contentType: false,
            success: function(res) {

                var _data = JSON.parse(res)
                _data = JSON.parse(_data)
                var src = '/meetTWO/public/static/picture/userHeadImg/' + _data.data + '/img.png?rand=' + Math.random()
                $('img').attr('src', src)
                alert('上传成功')
            },
            error: function() {
                alert('网络错误')
            }

        })

    })
</script>

</html>